home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _SGETNL.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  80 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #if    BUG68K
  5. #ifndef NDEBUG
  6. char *rcsid__sgetnl = "$Header: c:/curses/private/RCS/_sgetnl.c%v 2.0 1992/11/15 03:24:38 MH Rel $";
  7. #endif
  8.  
  9. void c_setnl( char* );         /* conv nl -> CTRL-\ */
  10. void c_getnl( char* );         /* conv CTRL-\ -> nl */
  11. /*man-start*********************************************************************
  12.  
  13.   _setnl()     - BUG68K: set newline for 68000 C compiler
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses function.
  17.  
  18.        This function circumvents a problem in the 68000 C library: If
  19.        the standard sprintf is used, it will ignore any newlines in
  20.        the format string. Therefore this routine changes the newlines
  21.        to CTRL-\ characters, to be restored later by the getnl()
  22.        function.
  23.  
  24.   PDCurses Return Value:
  25.        This function does not return a value.
  26.  
  27.   PDCurses Errors:
  28.        There are no defined errors for this routine.
  29.  
  30.   Portability:
  31.        PDCurses        void    c_setnl( char* fmt );  /* BUG68K only */
  32.  
  33. **man-end**********************************************************************/
  34.  
  35. void   _setnl(char *fmt)
  36. {
  37.        while (*fmt)
  38.        {
  39.                if (*fmt == '\n')
  40.                        *fmt = 0x1c;
  41.                fmt++;
  42.        }
  43. }
  44.  
  45.  
  46.  
  47.  
  48. /*----------------------------------------------------------------------
  49. $ _getnl()     - BUG68K: get newline for 68000 C compiler
  50. $
  51. $ PDCurses Description:
  52. $      This is a private PDCurses function.
  53. $
  54. $      This function circumvents a problem in the 68000 C library: If
  55. $      the standard sprintf is used, it will ignore any newlines in
  56. $      the format string. Therefore this routine changes CTRL-\
  57. $      characters (already set by setnl()) back to newlines.
  58. $
  59. $ PDCurses Return Value:
  60. $      This function does not return a value.
  61. $
  62. $ PDCurses Errors:
  63. $      There are no defined errors for this routine.
  64. $
  65. $ Portability:
  66. $      PDCurses        void    c_getnl( char* fmt );  /* BUG68K only */
  67. $
  68. $----------------------------------------------------------------------
  69. */
  70. void   _getnl(fmt)
  71. char*  fmt;
  72. {
  73.        while (*fmt)
  74.        {
  75.                if (*fmt == 0x1c)
  76.                        *fmt = '\n';
  77.        }
  78. }
  79. #endif
  80.